<?php

	//getProduct.php
	//Function used to retrieve Product information stored within the database.
	//Original Creator: Paul Venn
	
	//Includes exectureQuery.php to assure Database Connection and SQL Execution
	include "executeQuery.php";
	
	//Retrieves variables from ActionScript forms
	$productID = $_REQUEST['productID'];
	$productPrice = $_REQUEST['productPrice'];
	$productName = $_REQUEST['productName'];
	$productDescription = $_REQUEST['productDescription'];
		
	echo getProduct($productID);
	
	function getProduct($productID)
	{
			//Basic query to collect all data that has the ID productID
			$productQuery = "SELECT * FROM `tblProducts` WHERE `productID` = '" . $productID . "'";
			$productResults = executeQuery($productQuery);
			$productArray = mysql_fetch_array($productResults);
				
			//Sets the data retrieved from the Query into an XML format to be read by ActionScript
			$productXML = "<product>"
					. "\n<productID>" . $userArray['productID'] . "</productID>"
					. "\n<productPrice>" . $userArray['productPrice'] . "</productPrice>"
					. "\n<productName>" . $userArray['productName'] . "</productName>"
					. "\n<productDescription>" . $userArray['productDescription'] . "</productDescripton>"
					. "\n</product>";
			return $productXML;
		}
	}
	
?>
